package cn.gzsxt.music.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import cn.gzsxt.music.interceptor.CheckLoginInterceptor;

@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter{
	
	@Autowired
	private CheckLoginInterceptor checkLogin;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {

		registry.addInterceptor(checkLogin)
		.addPathPatterns("/**") //需要被拦截的
		.excludePathPatterns("/index/login.do"); //放行的
		super.addInterceptors(registry);
	}
}
